invoke

public abstract T invoke<T>(@Nullable() JsObject object, Array<Object> args)

Invokes this function on the given object with the specified args. This method blocks the current thread until the function finishes its execution. If the function raises an exception, then a JsException with an error message that describes the exception reason will be thrown. The same error message will be printed to the JavaScript console.

The rules to convert Java types into JavaScript types and vice versa are the same as for the call method.

Parameters

object

the JavaScript object to invoke this function on. Pass null to invoke the function as a global function.

args

the list of input arguments

<T>

the result of the JavaScript function execution

Throws

when an error occurs during the function execution

when args contains an unsupported type

when the JavaScript object is already disposed or invalid